from ..ScriptWidget import ScriptWidget
from enums.WidgetType import WidgetType
from PySide6.QtWidgets import QLabel


class Break(ScriptWidget):
    def __init__(self, initType=None):
        super(Break, self).__init__(WidgetType.BREAK)
        self.initType = initType

        self.labTitle = QLabel('中断循环:', self)
        self.labTitle.setFixedSize(60, self.lineHeight)
        self.addWidget(self.labTitle)

        if initType == 'edit' or initType == 'create':
            self.addOperate()

    @property
    def data(self):
        return {
            "type": self.type.value,
            'enable': self.switchEnable.isChecked()
        }

    @data.setter
    def data(self, data):
        pass
